/*
 *  ADomain.h
 *
 *
 *  Created by Peter on 23.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef A_DOMAIN_H
#define A_DOMAIN_H

#include "AObject.h"

#include <memory> /*for std::auto_ptr*/

class AStream;

/*
 * A domain is the main container of a serializable document in a file.
 * It is known to contain either an AObjDoc (bins, settings files and projects)
 * or ASeqDoc (only in settings files).
 * Version: 1
 */
class ADomain : public AObject
{

public:

	A_DECLARE_CLASS( 'DOMN', ADomain, AObject );

	// This is the AObject override. It just calls the overloaded function and
	// discards the objd reference. In theory, this would only ever be called if
	// you store an ADomain nested inside an AObjDoc domain.
	virtual void readFromStream( AStream& str, const AObjDoc& objd );

	// We can actually read/write ADomains without an AObjDoc (in fact, most of
	// the time we contain one), so this is the more frequent use case.
	void readFromStream( AStream& str );
	void writeToStream( AStream& str );

	std::auto_ptr< AObject > _object;
};

#endif /*Inclusion Guard*/
